<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
  <head>  
    <title>Albums</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link rel="stylesheet" media="screen" type="text/css" title="Design" href="style.css" />
	<script language="JavaScript" type="text/javascript" href="index.js">
<!--
function menuderoulant(selection){
window.location=selection.options[selection.selectedIndex].value;
}
-->
	</script>
    </head>
	<body>
   <h1>Gestion de groupes de musique</h1>
    <div id="menu">
      <ul id="onglets">
	<li><a href="index.php"> Accueil </a></li>
	<li><a href="groupes.php?gp=0"> Groupes </a></li>
	<li><a href="musiciens.php?nom=0"> Musiciens </a></li>
	<li><a href="evenements.php?cat=0"> Ev&eacute;nements </a></li>
	<li class="active"><a> Albums </a></li>
      </ul>
      <br /><br /><br />
	  <form name="form1">
	<div align="center"> 
		<select name="menu" onChange="menuderoulant(this)">
		<option value="#">Trier par</option>
		<option value="albums.php?album=2">Date de sortie</option>
		<option value="albums.php?album=1">Groupe</option>
		</select>
	</div>
	<a href="mises_a_jour.php?var=album"> Ajouter un album &agrave; la base </a>
    
	</form>
    	<?php 
      include('connexion.php');
	  if($_GET['album']==0){$cmp="";}
	  else if($_GET['album']==1){$cmp="order by NOM_GROUPE asc";}
	  else if($_GET['album']==2){$cmp="order by DATE_SORTIE desc";}
      $sql = "select * from ALBUM ".$cmp;
      $reponse=mysql_query($sql);
      ?>
	<center>    
	<strong>Albums</strong><br /><br />
   
   <?php
	 if(isset($_GET['kill'])==1){
	 if($_GET['kill']==1){
	
	$sql1="delete from ALBUM where TITRE_ALBUM='".$_GET['titre_album']."'";
	$reponse1=mysql_query($sql1);
}}?>
	 <table border="1" width="50%">

		<tbody>
			<tr>
				<td>   
					<center>Titre de l'album</center>

				</td>

				<td>
					<center>Date de sortie</center>
				</td>

				<td>
					<center>Nom du groupe</center>
				</td>
			</tr>
			
	<?php
	function date_fr($date) { 
				$split = explode("-",$date); 
				$annee = $split[0]; 
				$mois = $split[1]; 
				$jour = $split[2]; 
				return "$jour"."/"."$mois"."/"."$annee"; 
	}
 while ($donnees = mysql_fetch_array($reponse))
     {
	 ?>
			<tr>
				<td>   
					<center> <a href="album.php?titre_album=<?php echo $donnees['TITRE_ALBUM'] ?>&amp;choix=0" > <?php echo $donnees['TITRE_ALBUM'] ?></a></center>

				</td>
					
				<td>
					<?php
					$date=date_fr($donnees['DATE_SORTIE']);
					?>
					<center><?php echo $date;?></center>
				</td>

				<td>
					<center><a href="groupe.php?name_group=<?php echo $donnees['NOM_GROUPE']; ?>"><?php echo $donnees['NOM_GROUPE'];?></center>
				</td>
			</tr>
     
    <?php
	
}
    mysql_close($link);
      ?>
	 </tbody>
	</table>
	</center>
  </body>
</html>
